package midterm.demo3;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;
import java.util.regex.Pattern;

public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] month = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        int year = 365;
        System.out.println("请输入您要查询的也月份(eg:2022-02)：");
        String command = sc.next();
        command += "-01";
        //DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月");
        //LocalDate begin = LocalDate.of(2024, 2, 3);
        LocalDate cmdData = LocalDate.parse(command);
        int cmdYear = cmdData.getYear();
        int cmdMonth = cmdData.getMonthValue();
        int sum = (cmdYear - 2022) * year;
        for (int i = 2; i < cmdMonth; i++){
            sum += month[i];
        }
        sum %= 3;
        cmdData = cmdData.minusDays(1);
        for(int i = 3 + sum; i <= month[cmdMonth]; i+=3){
            if (i == 3 + sum) cmdData = cmdData.plusDays(i);
            else cmdData = cmdData.plusDays(3);
            int value = cmdData.getDayOfWeek().getValue();
            String s = "";
            if(value == 6) s = "(星期六)";
            if(value == 7) s = "(星期天)";
            System.out.println(cmdData + s);


        }



    }
}
